package com.rjxy.plansystemmanagement.service.impl;

import com.rjxy.plansystemmanagement.entity.User;
import com.rjxy.plansystemmanagement.mapper.UserMapper;
import com.rjxy.plansystemmanagement.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class UserServiceImpl implements UserService {
    @Autowired
    private UserMapper userMapper;

    @Override
    public List<User> list() {
        return userMapper.list();
    }

    @Override
    public void deleteUser(Integer id) {
        userMapper.deleteById(id);
    }

    @Override
    public void addUser(User user) {
        userMapper.addUser(user);
    }

    @Override
    public User getUserById(Integer id) {
        return userMapper.getUserById(id);
    }

    @Override
    public void updateUser(User user) {
        userMapper.updateUser(user);
    }

    @Override
    public User login(User user) {
        return userMapper.getUserByUserNameAndPassword(user);
    }

    @Override
    public User getUserByUserName(String UserName) {
        return userMapper.getUserByUserName(UserName);
    }

}
